home *** CD-ROM | disk | FTP | other *** search
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- END
- Attribute VB_Name = "clscFileSysItems"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private colData As New Collection
-
- 'Requred property (or function)
- Public Property Get Item(Index) As clsFileSysItem
- Set Item = colData(Index)
- End Property
-
- 'Requred property (or function)
- Public Property Get Count()
- Count = colData.Count
- End Property
-
- Public Sub Add(NewItem As clsFileSysItem)
- colData.Add NewItem
- End Sub
-
- Public Sub Create(strDirPath As String)
- Dim fsItem As clsFileSysItem
- Dim strTemp As String
- Dim strExt As String
-
- 'Folders first
- strTemp = Dir(strDirPath, vbDirectory)
-
- Do While strTemp <> ""
- If strTemp <> "." And strTemp <> ".." Then
- ' Use bitwise comparison to make sure MyName is a directory.
- If (GetAttr(strDirPath & strTemp) And vbDirectory) = vbDirectory Then
-
- Set fsItem = New clsFileSysItem
-
- With fsItem
- .Name = strTemp
- .DateModified = FileDateTime(strDirPath & strTemp)
- .Size = FileLen(strDirPath & strTemp)
- .strDirPath = strDirPath
- .Image = "Folder"
- End With
-
- colData.Add fsItem
-
- End If
-
- End If
- strTemp = Dir
- Loop
-
- For Each fsItem In colData
-
- fsItem.HasChildren = Dir(strDirPath & fsItem.Name & "\") <> ""
-
- If fsItem.HasChildren = False Then
- strTemp = Dir(strDirPath & fsItem.Name & "\", vbDirectory)
- Do While strTemp <> ""
- If strTemp <> "." And strTemp <> ".." Then
- fsItem.HasChildren = True
- End If
- strTemp = Dir
- Loop
- End If
-
- Next
-
- 'files now ...
- strTemp = Dir(strDirPath)
-
- Do While strTemp <> ""
- If strTemp <> "." And strTemp <> ".." Then
- ' Use bitwise comparison to make sure MyName is a directory.
- If (GetAttr(strDirPath & strTemp) And vbDirectory) <> vbDirectory Then
-
- Set fsItem = New clsFileSysItem
-
- With fsItem
- .Name = strTemp
- .DateModified = FileDateTime(strDirPath & strTemp)
- .Size = FileLen(strDirPath & strTemp)
- .strDirPath = strDirPath
- strExt = Right(strTemp, 4)
- If strExt = ".EXE" Or strExt = ".COM" Or strExt = ".BAT" Or strExt = ".DLL" Or strExt = ".SYS" Or strExt = ".VXD" Then
- .Image = "Program"
- Else
- .Image = "File"
- End If
- End With
-
- colData.Add fsItem
-
- End If
-
- End If
- strTemp = Dir
- Loop
-
- End Sub
-
-